<template>
    <div>
        <van-card v-for="(item, index) in arr" :key="index" :price="item.goods_price" :title="item.goods_name" :thumb="item.goods_big_logo" @click="t(item.goods_id)"/>
    </div>
</template>

<script setup>
import axios from 'axios';
import { ref } from 'vue';
import { useRouter,useRoute } from 'vue-router';
let router = new useRouter()
let route = new useRoute()
let arr = ref([])
axios.get('https://api-hmugo-web.itheima.net/api/public/v1/goods/search',{params:{cid:route.query.cid}}).then(res => {
    arr.value = res.data.message.goods
})
const t = (goods_id)=>{
        router.push({
        path: '/xqy',
        query: {
            // url的参数, 类似get请求的传参
            goods_id
        },
    })
}
</script>

<style></style>